package com.bjpowernode.service.impl;

import com.bjpowernode.entity.TDicValueDO;
import com.bjpowernode.mapper.TDicValueMapper;
import com.bjpowernode.service.TDicValueService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 */
@Service
public class TDicValueServiceImpl implements TDicValueService {

    @Resource
    private TDicValueMapper tDicValueMapper;

    @Override
    public Map<String, Integer> selectAllNameAndIdByClueState(String typeCode) {
        // 查询所有
        List<TDicValueDO> tDicValueDOList = tDicValueMapper.selectAllIdAndValuesByTypeCode(typeCode);
        Map<String , Integer> stringIntegerMap = new HashMap<>();
        // 遍历
        for (TDicValueDO tDicValueDO : tDicValueDOList) {
            stringIntegerMap.put(tDicValueDO.getTypeValue(), tDicValueDO.getId());
        }
        return stringIntegerMap;
    }

    @Override
    public Map<Integer, String> selectAllIdAndNameByTypeCode(String typeCode) {
        // 查询所有
        List<TDicValueDO> tDicValueDOList = tDicValueMapper.selectAllIdAndValuesByTypeCode(typeCode);
        Map<Integer , String> integerStringMap = new HashMap<>();
        // 遍历
        for (TDicValueDO tDicValueDO : tDicValueDOList) {
            integerStringMap.put(tDicValueDO.getId(), tDicValueDO.getTypeValue());
        }
        return integerStringMap;
    }

    @Override
    public List<TDicValueDO> loadClueNoteWay(String typeCode) {
        // 查询所有
        return tDicValueMapper.selectAllIdAndValuesByTypeCode(typeCode);
    }
}
